package com.leo.component;

import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.entity.component.Component;
import com.almasb.fxgl.physics.BoundingShape;
import com.almasb.fxgl.physics.HitBox;
import javafx.geometry.Point2D;

/**
 * @Author: wangss
 * @CreateTime: 2023-06-07  12:21
 * @Description: 箭头
 */
public class ArrowComponent extends Component {

    private static int index = 0;

    public ArrowComponent() {

    }

    @Override
    public void onAdded() {
        entity.getViewComponent().addChild(FXGL.texture("arrow" + (index++ % 5) + ".png"));
        // 设置bbox大小
        entity.getBoundingBoxComponent().addHitBox(new HitBox(new Point2D(16, 5), BoundingShape.box(83, 2)));
    }
}
